var app = new Vue({
    el: "#app",
    data: {
        userInfo: {},
    },
    methods: {
        updateInfo() {
            const user = this.userInfo;
            layui.use(['form', 'layer', 'comExt'], function (form, layer, comExt) {
                //屏幕可用工作区宽
                const clientWidth = window.screen.availWidth;
                const wid = clientWidth + "px";
                //屏幕可用工作区高
                const clientHeight = window.screen.availHeight;
                const hei = clientHeight + "px";
                var index = layer.open({
                    title: "修改用户",
                    type: 2,
                    anim: -1,
                    area: [wid, hei],
                    content: "personal-edit.html",
                    success: function (layero, index) {
                        var body = layui.layer.getChildFrame('body', index);
                        $(document).find("input[type=radio]").val(user.role);
                        comExt.fillInput(body, user);
                    }
                });
                comExt.full(index);
                /* 渲染表单 */
                form.render();
            });

        },
        personalShow() {
            const user = this.userInfo;
            layui.use(['form', 'layer', 'comExt'], function (form, layer, comExt) {
                //屏幕可用工作区宽
                const clientWidth = window.screen.availWidth;
                const wid = clientWidth + "px";
                //屏幕可用工作区高
                const clientHeight = window.screen.availHeight;
                const hei = clientHeight + "px";
                var index = layer.open({
                    title: "查看用户",
                    type: 2,
                    anim: -1,
                    area: [wid, hei],
                    content: "personal-show.html",
                    success: function (layero, index) {
                        var body = layui.layer.getChildFrame('body', index);
                        $(document).find("input[type=radio]").val(user.role);
                        comExt.fillInput(body, user);
                    }
                });
                comExt.full(index);
                /* 渲染表单 */
                form.render();
            });
        }
    },
    mounted() {
        const that = this;
        $.ajax({
            url: "../user/" + parseInt(Base64.decode(getToken())),
            success: function (data) {
                that.userInfo = data.obj;
            }
        });
    }
});